from anycloud import config
from anycloud.task import map, TASK_SUBMITTED

class Engine(object):
    def __init__(self, **kwargs):
        config.setparams(self, kwargs)

    def retrieve(self, tasks):
        pass

    def submit(self, tasks):
        for task in tasks:
            task.status = TASK_SUBMITTED
        return tasks

    def execute(self, tasks):
        return self.retrieve(self.submit(tasks))

    def map(self, func, seq, **kwargs):
        return map(func, seq, **kwargs)

